﻿using System;
using System.Reflection;

namespace MyGeneric
{
    class Program
    {
        /// <summary>
        /// 1.动态加载 Assembley.Load()
        /// 2.获取类型 assembley.GetType()
        /// 3.创建对象 Activator.CreateInstance()
        /// 4.类型装换 
        /// 5.方法调用
        /// 包装一下
        /// 反射的动态加载和动态创建对象 以及配置文件结合
        /// 反射破坏单例 私有构造函数突破
        /// 实例化泛型类
        /// 反射创建了对象实例--有方法的名称--反射调用方法
        /// 反射调用私有方法，调用泛型方法
        /// 
        /// 
        /// 
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            CommonMethod.Show<int>(1);
            CommonMethod.Show<string>("www");
            CommonMethod.Show<bool>(false);

            Bird bird = new Bird();
            Bird bird1 = new Sparrow();

            Sparrow sparrow = new Sparrow();
            //Sparrow sparrow1 = (Sparrow)new Bird();
            try
            {
                Assembly assembly = Assembly.Load("Test1.Core.Interface");
                Assembly assembly1 = Assembly.LoadFile(@"D:\workspace\RuanMou\Test1.Core.Service\bin\Debug\netcoreapp3.1\Test1.Core.Service.dll");

            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }


            Console.ReadKey();

        }
    }
}
